Question: Let $f$ be a function defined on the positive integers, such that
\[f(xy) = f(x) + f(y)\]for all positive integers $x$ and $y.$  Given $f(10) = 14$ and $f(40) = 20,$ find $f(500).$
Answer: Let $a = f(2)$ and $b = f(5).$  Setting $x = 2$ and $y = 5,$ we get
\[14 = f(10) = f(2) + f(5) = a + b.\]Setting $x = 10$ and $y = 2,$ we get
\[f(20) = f(10) + f(2) = a + b + a = 2a + b.\]Setting $x = 20$ and $y = 2,$ we get
\[20 = f(40) = f(20) + f(2) = 2a + b + a = 3a + b.\]Solving the system $a + b = 14$ and $3a + b = 20,$ we find $a = 3$ and $b = 11.$  Then
\begin{align*}
f(500) &= f(2 \cdot 2 \cdot 5 \cdot 5 \cdot 5) \\
&= f(2) + f(2) + f(5) + f(5) + f(5) \\
&= 2 \cdot 3 + 3 \cdot 11 \\
&= \boxed{39}.
\end{align*}